//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package info.sean.logger;

import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class GmfLogger implements Logger {
    private static GmfLogger LOGGERBUILDER = initLogger();
    private static final Map<MethodClassKey, String> readableMethodIds = new ConcurrentHashMap(1024);

    public GmfLogger() {
    }

    public static GmfLogger getLogger(Class<?> clazz) {
        return getLogger(clazz.getName());
    }

    public static GmfLogger getLogger(String loggerName) {
        return LOGGERBUILDER.createNewLogger(loggerName);
    }

    protected abstract GmfLogger createNewLogger(String var1);

    public abstract void logTraceInfoTMDC();

    public abstract void cleanTraceInfoInMDC();

    public abstract void extInfo(String var1, EventPair var2);

    public abstract Tracer buildTracer();

    public abstract void launchOnlineChange();

    private static GmfLogger initLogger() {
        String DEFAULT_GMF_LOGGER_BINDER = "com.gomefinance.framework.log.cat.client.GmfLoggerImpl";

        try {
            return (GmfLogger)Class.forName(DEFAULT_GMF_LOGGER_BINDER).newInstance();
        } catch (Exception var4) {
            EmptyGmfLoggerImpl emptyGmfLoggerImpl = new EmptyGmfLoggerImpl();
            Logger logger = LoggerFactory.getLogger(GmfLogger.class);
            logger.error("no advance logger jar");
            return emptyGmfLoggerImpl;
        }
    }

    public static String getReadableMethodId(Class clz, Method method) {
        MethodClassKey methodClassKey = new MethodClassKey(method, clz);
        String methodId = (String)readableMethodIds.get(methodClassKey);
        if (methodId == null) {
            String params = "";
            Class<?>[] parameterTypes = method.getParameterTypes();

            for(int j = 0; j < parameterTypes.length; ++j) {
                if (parameterTypes[j].isArray()) {
                    try {
                        Class<?> cl = parameterTypes[j];

                        int dimensions;
                        for(dimensions = 0; cl.isArray(); cl = cl.getComponentType()) {
                            ++dimensions;
                        }

                        StringBuilder sb = new StringBuilder();
                        sb.append(cl.getName());

                        for(int i = 0; i < dimensions; ++i) {
                            sb.append("A");
                        }

                        params = params + sb;
                    } catch (Throwable var11) {
                    }
                } else {
                    params = params + parameterTypes[j].getName();
                }

                if (parameterTypes.length > 1 && j != parameterTypes.length - 1) {
                    params = params + ",";
                }
            }

            methodId = clz.getName() + "." + method.getName() + "(" + params + ")";
            readableMethodIds.put(methodClassKey, methodId);
        }

        return methodId;
    }
}
